const { http } = uni.$u;
/**
 * 获取商品列表
 */
export const fetchGoodsPageList = (params, config) => {
  return http.post("/oms/goods/getPageList", params, {
    ...config,
    custom: {
      needToken: false,
    },
  });
};
/**
 * 获取商品详情
 */
export const fetchGoodsDetail = (params, config) => {
  return http.post("/oms/goods/getDetail", params, config);
};

/**
 * 获取商品分类列表
 */
export const fetchGoodsCategoryList = (params, config) => {
  return http.post("/oms/goodsCategory/getList", params, config);
};

/**
 * 新增收货地址
 */
export const fetchDeliveryAddress = (params, config) => {
  return http.post("/oms/deliveryAddress/add", params, config);
};

/**
 * 获取收货地址
 */
export const fetchDeliveryAddressList = (params, config) => {
  return http.post("/oms/deliveryAddress/getList", params, config);
};

/**
 * 删除收货地址
 */
export const fetchDeliveryAddressDelete = (params, config) => {
  return http.post("/oms/deliveryAddress/delete", params, config);
};

/**
 * 设置默认收货地址
 */
export const fetchSetDeliveryAddressDefault = (params, config) => {
  return http.post("/oms/deliveryAddress/setDefaultAddress", params, config);
};

/**
 * 商品加入购物车
 */
export const fetchShoppingCartAdd = (params, config) => {
  return http.post("/oms/shoppingCart/add", params, config);
};

/**
 * 创建订单
 */
export const fetchOrderCreate = (params, config) => {
  return http.post("/oms/uniflyOrder/create", params, config);
};

/**
 * 获取订单详情
 */
export const fetchOrderDetail = (params, config) => {
  return http.post("/oms/uniflyOrder/getDetail", params, config);
};

/**
 * 支付
 */
export const fetchPayment = (params, config) => {
  return http.post("/oms/uniflyOrder/pay", params, config);
};

/**
 * 产地溯源列表
 */
export const fetchGoodsOriginList = (params, config) => {
  return http.post("/oms/goodsOrigin/getPageList", params, config);
};

/**
 * 购物车列表
 */
export const fetchShoppingCartList = (params, config) => {
  return http.post("/oms/shoppingCart/getList", params, {
    ...config,
    custom: {
      needToken: true,
    },
  });
};

/**
 * 开通会员
 */
export const fetchUniflyOrderCreateAndPay = (params, config) => {
  return http.post("/oms/uniflyOrder/createAndPay", params, config);
};

/**
 * 商品专栏
 */
export const fetchGoodsSpecialColumnList = (params, config) => {
  return http.post("/oms/goodsSpecialColumn/getList", params, config);
};

/**
 * 商品专栏商品列表
 */
export const fetchGoodsSpecialColumnGoodsList = (params, config) => {
  return http.post("/oms/goodsSpecialColumn/getGoodsList", params, config);
};

/**
 * 营销活动列表
 */
export const fetchMiActivityList = (params, config) => {
  return http.post("/oms/miActivity/getList", params, config);
};

/**
 * 营销活动商品列表
 */
export const fetchMiActivityGooodsList = (params, config) => {
  return http.post("/oms/miActivity/getGoodsList", params, config);
};

/**
 * 获取参与活动的商品列表
 */
export const fetchMiActivityGoodsList = (params, config) => {
  return http.post("/oms/miActivity/getGoodsList", params, config);
};

/**
 * 获取我的订单
 */
export const fetchUniflyOrderList = (params, config) => {
  return http.post("/oms/uniflyOrder/getPageList", params, config);
};

/**
 * 获取客户的订单
 */
export const fetchCustomerOrderList = (params, config) => {
  return http.post("/oms/customerOrder/getPageList", params, config);
};

/**
 * 删除购物车
 */
export const fetchShoppingCartDelete = (params, config) => {
  return http.post("/oms/shoppingCart/delete", params, config);
};

/**
 * 获取我的优惠券列表
 */
export const fetchMyCouponList = (params, config) => {
  return http.post("/oms/customerCoupon/getList", params, config);
};
